package com.rms.recruit_management_system.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rms.recruit_management_system.mapper.InterviewFeedbackVoMapper;
import com.rms.recruit_management_system.pojo.InterviewFeedback;
import com.rms.recruit_management_system.service.InterviewFeedbackService;
import com.rms.recruit_management_system.utils.Result;
import com.rms.recruit_management_system.vo.InterviewFeedbackVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class InterviewFeedbackController {

    @Autowired
    private  InterviewFeedbackService interviewFeedbackService;
    @Autowired
    private InterviewFeedbackVoMapper interviewFeedbackVoMapper;
    @RequestMapping("/InterviewFeedback/addInterviewFeedback")
    public Result<?> addInterviewFeedback(@RequestBody InterviewFeedback interviewFeedback){
        interviewFeedbackService.addInterviewFeedback(interviewFeedback);
        return new Result<>(200,"success");
    }
    @RequestMapping("/InterviewFeedback/deleteInterviewFeedback/{id}")
    public Result<?> deleteInterviewFeedback(@PathVariable Integer id){
        interviewFeedbackService.deleteInterviewFeedback(id);
        return new Result<>(200,"success");
    }
    @RequestMapping("/InterviewFeedback/getInterviewFeedback")
    public Result<?> getInterviewFeedback(@RequestParam(defaultValue = "1") int current,
                                          @RequestParam(defaultValue = "10") int size){
        Page<InterviewFeedbackVo> page=new Page<>(current,size);
        IPage<InterviewFeedbackVo> list=interviewFeedbackVoMapper.getInterviewFeedbackVoList(page);
        return new Result<>(200,"success",list);
    }
}
